package com.charlotte.study.gupao.template.course;

/**
 * @author junjie.ding
 * @date 2020/3/13
 */
public abstract class AbstractCourse {

    public final void createCourse(){

        // 1. 发布预习作业
        publishPreWork();

        // 2. 准备PPT;
        preparePPT();

        // 3. 直播课
        startLiveShow();

        // 4. 课后作业
        homework();

        // 5. 批改作业
        if(needCheckHomework()){
            checkHomework();
        }
    }

    protected abstract void checkHomework();

    private void homework() {
        System.out.println("布置课后作业");
    }

    private void startLiveShow() {
        System.out.println("开始直播");
    }

    private void preparePPT(){
        System.out.println("准备课程PPT");
    }

    private void publishPreWork() {
        System.out.println("发布预习资料");
    }

    // 钩子方法，默认返回false
    protected boolean needCheckHomework(){
        return false;
    }
}
